package com.whj.servicedriveruser.controller;

import com.whj.internalcommon.dto.Car;
import com.whj.internalcommon.dto.ResponseResult;
import com.whj.servicedriveruser.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: wanghaijun
 * @Date: 2023/1/13 - 01 - 13 - 11:09 
 * @Description: com.whj.servicedriveruser.controller
 */

@RestController
public class CarController {

    @Autowired
    private CarService carService;

    /**
     * 添加车辆信息
     *
     * @param car
     * @return
     */
    @PostMapping("/car")
    public ResponseResult addCar(@RequestBody Car car) {

        System.out.println("car = " + car);
        return carService.addCar(car);
    }

    /**
     * 根据id信息查询车辆信息
     *
     * @param carId
     * @return
     */
    @GetMapping("/car")
    public ResponseResult<Car> getCarById(@RequestParam Long carId) {
        return carService.getCarById(carId);
    }
}
